import request from '@/utils/request'

// 查询巡检计划列表
export function listInspectionPlan(query) {
  return request({
    url: '/ldzl-sb/inspection/plan/findAll/',
    method: 'get',
    params: query
  })
}

// 查询巡检计划详细
export function getInspectionPlan(id) {
  return request({
    url: '/ldzl-sb/inspection/plan/findById/',
    method: 'get',
    params: { plan_id: id }
  })
}

// 新增巡检计划
export function addInspectionPlan(data) {
  return request({
    url: '/ldzl-sb/inspection/plan/save/',
    method: 'post',
    data: data
  })
}

// 修改巡检计划
export function updateInspectionPlan(data) {
  return request({
    url: '/ldzl-sb/inspection/plan/update/',
    method: 'post',
    data: data
  })
}

// 删除巡检计划
export function delInspectionPlan(id) {
  return request({
    url: '/ldzl-sb/inspection/plan/delete/',
    method: 'get',
    params: { plan_id: id }
  })
}

// 获取自动生成的巡检计划编码
export function generateInspectionPlanCode() {
  return request({
    url: '/ldzl-sb/inspection/plan/getNumber/',
    method: 'get'
  })
}

// 查询巡检项目列表
export function listInspectionItem(query) {
  return request({
    url: '/ldzl-sb/inspection/item/findAll/',
    method: 'get',
    params: query
  })
}

// 查询巡检项目详细
export function getInspectionItem(id) {
  return request({
    url: '/ldzl-sb/inspection/item/findById/',
    method: 'get',
    params: { item_id: id }
  })
}

// 新增巡检项目
export function addInspectionItem(data) {
  return request({
    url: '/ldzl-sb/inspection/item/save/',
    method: 'post',
    data: data
  })
}

// 修改巡检项目
export function updateInspectionItem(data) {
  return request({
    url: '/ldzl-sb/inspection/item/update/',
    method: 'post',
    data: data
  })
}

// 删除巡检项目
export function delInspectionItem(id) {
  return request({
    url: '/ldzl-sb/inspection/item/delete/',
    method: 'get',
    params: { item_id: id }
  })
}

// 查询巡检记录列表
export function listInspectionRecord(query) {
  return request({
    url: '/ldzl-sb/inspection/record/findAll/',
    method: 'get',
    params: query
  })
}

// 查询巡检记录详细
export function getInspectionRecord(id) {
  return request({
    url: '/ldzl-sb/inspection/record/findById/',
    method: 'get',
    params: { record_id: id }
  })
}

// 新增巡检记录
export function addInspectionRecord(data) {
  return request({
    url: '/ldzl-sb/inspection/record/save/',
    method: 'post',
    data: data
  })
}

// 修改巡检记录
export function updateInspectionRecord(data) {
  return request({
    url: '/ldzl-sb/inspection/record/update/',
    method: 'post',
    data: data
  })
}

// 删除巡检记录
export function delInspectionRecord(id) {
  return request({
    url: '/ldzl-sb/inspection/record/delete/',
    method: 'get',
    params: { record_id: id }
  })
}

// 完成巡检
export function completeInspection(data) {
  return request({
    url: '/ldzl-sb/inspection/record/complete/',
    method: 'post',
    data: data
  })
} 